/**
 * Copyright(c) kyle.
 */
package org.example.jvm;

/**
 * 静态分派
 *
 * @author kyle
 * @version 1.00.00
 * @since [2020-12-03 11:35]
 * @updateUser [Kyle]
 * @updateRemark [说明本次修改内容]
 * @date [2020-12-03 11:35]
 */
public class StaticDispatch {
    private static abstract class Human {
    }

    private static class Man extends Human{}
    private static class Woman extends Human{}
    public void sayHello(Human guy){
        System.out.println("hello,guy!");
    }
    public void sayHello(Man guy){
        System.out.println("hello,gentleman!");
    }
    public void sayHello(Woman guy){
        System.out.println("hello,lady!");
    }

    /**
     * hello,guy!
     * hello,guy!
     * @param args
     */
    public static void main(String[] args) {
        Human man=new Man();
        Human woman=new Woman();
        StaticDispatch sr=new StaticDispatch();
        sr.sayHello(man);
        sr.sayHello(woman);

        sr.sayHello((Man)man);
        sr.sayHello((Woman)woman);
    }
}
